<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<title>决策管理</title>
</head>
<?php
	 include 'FusionCharts.php';
	 function getColor(){
	 	for($i=0;$i<6;$i++){
	 		$color = dechex(rand(0,15));
	 		$ret .= $color;
	 	}
	 	return $ret;
	 }
?>
<body>
	<div id="wrap">
    	<div class="m_head">
        	<div class="m_positin">咨询统计</div>
        </div>
        <div class="qf_box">
            <div class="bh">咨询统计</div>
            <div class="bc">
<?php
if(is_array($data) && count($data)>0){
		//Create an XML data document in a string variable
		$strXML  = "";
		$strXML .= "<graph caption='咨询统计' xAxisName='Department' yAxisName='NUMS'
  showValues='1' decimalPrecision='0' bgcolor='F3f3f3' bgAlpha='70'
  showColumnShadow='1' divlinecolor='c5c5c5' divLineAlpha='60' showAlternateHGridColor='1'
  alternateHGridColor='f8f8f8' alternateHGridAlpha='60'><categories font='Arial' fontSize='12' fontColor='000000'>";
		foreach ($data as $v){
			$strXML .= '<category name=\''.$v['name'].'\'/>';
		}
		$strXML .= "</categories><dataset seriesname='已回复' color='4fac12'>";
		foreach ($data as $v){
			$handle = $v['handle']?$v['handle']:0;
			$strXML .= '<set value=\''.$handle.'\'/>';
		}
		$strXML .= '</dataset>
			<dataset seriesname=\'未回复\' color=\'FFAA25\'>';
		foreach ($data as $v){
			$handle = $v['nothandle']?$v['nothandle']:0;
			$strXML .= '<set value=\''.$v['nothandle'].'\'/>';
		}
		$strXML .= "</dataset><trendlines>
    <line startValue='26000' color='91C728' displayValue='Target' showOnTop='1'/>
  </trendlines></graph>";
//Create the chart - Column 3D Chart with data from strXML variable using dataXML method
	echo renderChartHTML("/images/FCF_MSColumn3D.swf", "", $strXML, "myNext", 900, 300);
}
?>
                <table class="qf_table" width="70%" border="0" cellpadding="0" cellspacing="1">
                  <tr><th width="30%" rowspan="2">科室</th><th width="30%" colspan="2">处理状态</th><th width="30%" rowspan="2">总结</th></tr>
                  <tr>
                    <th>已回复</th>
                    <th>未回复</th>
                  </tr>
<?php 
	if(is_array($data) && count($data)>0){
         foreach ($data as $v){
         			$tolhandle += $v['handle'];
         			$tolnothandle += $v['nothandle'];
?>
                  <tr><td><?php echo $v['name']?></td><td><?php echo $v['handle']?$v['handle']:0?></td><td><?php echo $v['nothandle']?$v['nothandle']:0?></td><td>总计：（<?php echo  $v['nothandle']+ $v['handle']?>）条,回复率（<?php echo number_format($v['handle']*100/($v['nothandle']+ $v['handle']),2)?>%）</td></tr>
<?php 
         }
	}else{
?>
		<tr><td colspan='10'>没有您查询的结果！</td></tr>
<?php }?>
				  <tr><td><b>总计</b></td><td><?php echo $tolhandle?$tolhandle:0?></td><td><?php echo $tolnothandle?$tolnothandle:0?></td><td>总计：（<?php echo  $tolnothandle+ $tolhandle?>）条,回复率（<?php $times = ($tolhandle + $tolnothandle)>0?($tolhandle + $tolnothandle):1;echo number_format($tolhandle*100/$times,2)?>%）</td></tr>
                  <tr height='20'><td colspan='10'></td></tr>
                </table>
            </div>
        </div>
    </div>
</body>
</html>
